package com.sto.stoapp.broadcast;

import com.sto.stoapp.activity.administrator.system.SystemKeyMgrActivity;
import com.sto.stoapp.db.StoFilePreference;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
/**
 * 防止420 6.1.23rom  灭屏后呼吸灯还亮
 * @author Administrator
 *
 */
public class ScreenReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();
		Log.i("ScreenReceiver", "ScreenReceiver onReceive");
		if (Intent.ACTION_SCREEN_ON.equals(action)
				&& StoFilePreference.getInstance(context).getLightSwitch()) {
			SystemKeyMgrActivity.light(context, true);
		} else if (Intent.ACTION_SCREEN_OFF.equals(action)
				&& StoFilePreference.getInstance(context).getLightSwitch()) {
			SystemKeyMgrActivity.light(context, false);
		}

	}

}
